<?php
/**
 * Created by PhpStorm.
 * User: user
 * Date: 2018/6/13
 * Time: 23:40
 */

namespace app\index\controller;

use think\Controller;
use think\Db;
use app\index\model\User;
class UserController extends Controller
{
    public function index(){
        $list=User::all();
        $this->assign('list',$list);
        $this->assign('count',count($list));
        return $this->fetch();


    }
    public function add(){
        $u=new User;
        $u->name='refr';
        $u->id=58;
        if($u->save()){
            return '用户'.$u->name.':'.$u->id.'新增';
        }else{
            return $u->getError();
        }
    }


}